package cn.weiyang.dao;

import cn.weiyang.model.Record;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import java.util.List;

/**
 * Created by Administrator on 2017-7-14.
 */
public class RecordDaoImpl extends HibernateDaoSupport implements RecordDao{
    /**
     * 根据交易号获取交易记录
     * @param record_id
     * @return
     */
    public Record get(long record_id) {
        return getHibernateTemplate().get(Record.class,record_id);
    }
    /**
     * 增加交易记录
     * @param record
     */
    public void addRecord(Record record) {
         getHibernateTemplate().save(record);
    }
    /**
     * 删除交易记录
     * @param record_id
     */
    public void delRecord(long record_id) {
         getHibernateTemplate().delete(record_id);
    }
    /**
     * 查询所有交易记录
     * @param hql
     * @return
     */
    public List<Record> findAllRecord(String hql) {
        return getHibernateTemplate().find(hql);
    }
}
